<%--
    Document   : userRecentNotifications
    Created on : Apr 27, 2014, 4:47:58 PM
    Author     : Anton Strack
--%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="csd" tagdir="/WEB-INF/tags" %>
<%@tag description="Lists the recent notifications for the currently logged in user. " pageEncoding="UTF-8"%>
<%@attribute name="userRecentNotifications" type="java.util.List<csdwa.Notification>"%>
<%@attribute name="emptyMessage" required="true"%>
<c:choose>
    <c:when test="${userRecentNotifications != null && userRecentNotifications.size() > 0}">
        <c:forEach items="${userRecentNotifications}" var="recentNotification" >
            <li id="rnid_${recentNotification.id}" class="list-group-item">${recentNotification.getDerivedValue('EventCreatorName')} ${recentNotification.getTemplate().name}<br />

                <a href="${req.contextPath}?action=delete&resource=notification&id=${recentNotification.id}&for=${fn:toLowerCase(recentNotification.getTemplate().getDerivedValue('SubjectResourceTypeName'))}">${recentNotification.resourceName}</a><br />
                On <csd:displayTimestamp timestamp="${recentNotification.notificationDate}"></csd:displayTimestamp><a class="delete_notification delete" href="${req.contextPath}?action=delete&resource=notification&id=${recentNotification.id}">&times;</a>
                </li>
        </c:forEach>
    </c:when>
    <c:otherwise>
        <li class="list-group-item">${emptyMessage}</li>
        </c:otherwise>
    </c:choose>








